## API Report File for "@backstage/catalog-client"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts
import { CompoundEntityRef } from '@backstage/catalog-model';
import { Entity } from '@backstage/catalog-model';
import { SerializedError } from '@backstage/errors';

// @public
export type AddLocationRequest = {
  type?: string;
  target: string;
  dryRun?: boolean;
};

// @public
export type AddLocationResponse = {
  location: Location_2;
  entities: Entity[];
  exists?: boolean;
};

// @public
export const CATALOG_FILTER_EXISTS: unique symbol;

// @public
export interface CatalogApi {
  addLocation(
    location: AddLocationRequest,
    options?: CatalogRequestOptions,
  ): Promise<AddLocationResponse>;
  getEntities(
    request?: GetEntitiesRequest,
    options?: CatalogRequestOptions,
  ): Promise<GetEntitiesResponse>;
  getEntitiesByRefs(
    request: GetEntitiesByRefsRequest,
    options?: CatalogRequestOptions,
  ): Promise<GetEntitiesByRefsResponse>;
  getEntityAncestors(
    request: GetEntityAncestorsRequest,
    options?: CatalogRequestOptions,
  ): Promise<GetEntityAncestorsResponse>;
  getEntityByRef(
    entityRef: string | CompoundEntityRef,
    options?: CatalogRequestOptions,
  ): Promise<Entity | undefined>;
  getEntityFacets(
    request: GetEntityFacetsRequest,
    options?: CatalogRequestOptions,
  ): Promise<GetEntityFacetsResponse>;
  getLocationByEntity(
    entityRef: string | CompoundEntityRef,
    options?: CatalogRequestOptions,
  ): Promise<Location_2 | undefined>;
  getLocationById(
    id: string,
    options?: CatalogRequestOptions,
  ): Promise<Location_2 | undefined>;
  getLocationByRef(
    locationRef: string,
    options?: CatalogRequestOptions,
  ): Promise<Location_2 | undefined>;
  queryEntities(
    request?: QueryEntitiesRequest,
    options?: CatalogRequestOptions,
  ): Promise<QueryEntitiesResponse>;
  refreshEntity(
    entityRef: string,
    options?: CatalogRequestOptions,
  ): Promise<void>;
  removeEntityByUid(
    uid: string,
    options?: CatalogRequestOptions,
  ): Promise<void>;
  removeLocationById(
    id: string,
    options?: CatalogRequestOptions,
  ): Promise<void>;
  validateEntity(
    entity: Entity,
    locationRef: string,
    options?: CatalogRequestOptions,
  ): Promise<ValidateEntityResponse>;
}

// @public
export class CatalogClient implements CatalogApi {
  constructor(options: {
    discoveryApi: {
      getBaseUrl(pluginId: string): Promise<string>;
    };
    fetchApi?: {
      fetch: typeof fetch;
    };
  });
  addLocation(
    request: AddLocationRequest,
    options?: CatalogRequestOptions,
  ): Promise<AddLocationResponse>;
  getEntities(
    request?: GetEntitiesRequest,
    options?: CatalogRequestOptions,
  ): Promise<GetEntitiesResponse>;
  getEntitiesByRefs(
    request: GetEntitiesByRefsRequest,
    options?: CatalogRequestOptions,
  ): Promise<GetEntitiesByRefsResponse>;
  getEntityAncestors(
    request: GetEntityAncestorsRequest,
    options?: CatalogRequestOptions,
  ): Promise<GetEntityAncestorsResponse>;
  // @deprecated (undocumented)
  getEntityByName(
    compoundName: CompoundEntityRef,
    options?: CatalogRequestOptions,
  ): Promise<Entity | undefined>;
  getEntityByRef(
    entityRef: string | CompoundEntityRef,
    options?: CatalogRequestOptions,
  ): Promise<Entity | undefined>;
  getEntityFacets(
    request: GetEntityFacetsRequest,
    options?: CatalogRequestOptions,
  ): Promise<GetEntityFacetsResponse>;
  getLocationByEntity(
    entityRef: CompoundEntityRef | string,
    options?: CatalogRequestOptions,
  ): Promise<Location_2 | undefined>;
  getLocationById(
    id: string,
    options?: CatalogRequestOptions,
  ): Promise<Location_2 | undefined>;
  getLocationByRef(
    locationRef: string,
    options?: CatalogRequestOptions,
  ): Promise<Location_2 | undefined>;
  queryEntities(
    request?: QueryEntitiesRequest,
    options?: CatalogRequestOptions,
  ): Promise<QueryEntitiesResponse>;
  refreshEntity(
    entityRef: string,
    options?: CatalogRequestOptions,
  ): Promise<void>;
  removeEntityByUid(
    uid: string,
    options?: CatalogRequestOptions,
  ): Promise<void>;
  removeLocationById(
    id: string,
    options?: CatalogRequestOptions,
  ): Promise<void>;
  validateEntity(
    entity: Entity,
    locationRef: string,
    options?: CatalogRequestOptions,
  ): Promise<ValidateEntityResponse>;
}

// @public
export interface CatalogRequestOptions {
  // (undocumented)
  token?: string;
}

// @public
export const ENTITY_STATUS_CATALOG_PROCESSING_TYPE =
  'backstage.io/catalog-processing';

// @public
export type EntityFieldsQuery = string[];

// @public
export type EntityFilterQuery =
  | Record<string, string | symbol | (string | symbol)[]>[]
  | Record<string, string | symbol | (string | symbol)[]>;

// @public
export type EntityOrderQuery =
  | {
      field: string;
      order: 'asc' | 'desc';
    }
  | Array<{
      field: string;
      order: 'asc' | 'desc';
    }>;

// @public
export interface GetEntitiesByRefsRequest {
  entityRefs: string[];
  fields?: EntityFieldsQuery | undefined;
}

// @public
export interface GetEntitiesByRefsResponse {
  items: Array<Entity | undefined>;
}

// @public
export interface GetEntitiesRequest {
  after?: string;
  fields?: EntityFieldsQuery;
  filter?: EntityFilterQuery;
  limit?: number;
  offset?: number;
  order?: EntityOrderQuery;
}

// @public
export interface GetEntitiesResponse {
  // (undocumented)
  items: Entity[];
}

// @public
export interface GetEntityAncestorsRequest {
  // (undocumented)
  entityRef: string;
}

// @public
export interface GetEntityAncestorsResponse {
  // (undocumented)
  items: Array<{
    entity: Entity;
    parentEntityRefs: string[];
  }>;
  // (undocumented)
  rootEntityRef: string;
}

// @public
export interface GetEntityFacetsRequest {
  facets: string[];
  filter?: EntityFilterQuery;
}

// @public
export interface GetEntityFacetsResponse {
  facets: Record<
    string,
    Array<{
      value: string;
      count: number;
    }>
  >;
}

// @public
type Location_2 = {
  id: string;
  type: string;
  target: string;
};
export { Location_2 as Location };

// @public
export type QueryEntitiesCursorRequest = {
  fields?: string[];
  limit?: number;
  cursor: string;
};

// @public
export type QueryEntitiesInitialRequest = {
  fields?: string[];
  limit?: number;
  filter?: EntityFilterQuery;
  orderFields?: EntityOrderQuery;
  fullTextFilter?: {
    term: string;
    fields?: string[];
  };
};

// @public
export type QueryEntitiesRequest =
  | QueryEntitiesInitialRequest
  | QueryEntitiesCursorRequest;

// @public
export type QueryEntitiesResponse = {
  items: Entity[];
  totalItems: number;
  pageInfo: {
    nextCursor?: string;
    prevCursor?: string;
  };
};

// @public
export type ValidateEntityResponse =
  | {
      valid: true;
    }
  | {
      valid: false;
      errors: SerializedError[];
    };
```
